﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using OznerOA.Common;
using OznerOA.BLL.Workflow.Request;

namespace OznerOA.UI.Workflow.Request
{
    public partial class FrmShowSubmitResult : FrmBase
    {
        private RequestViewBLL requestViewBLL = null;
        public RequestViewBLL RequestViewBLL
        {
            get { return requestViewBLL; }
            set { requestViewBLL = value; }
        }
        public FrmShowSubmitResult()
        {
            InitializeComponent();
        }

        #region 显示按钮按下
        private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            if (e.Button.Caption == "显示")
            {
                int rowHandle = gridView1.FocusedRowHandle;
                if (rowHandle >= 0 && rowHandle < _list.Count)
                {
                    Model.Workflow flow = _list[rowHandle];
                    logBLL.Debug(flow.FlowId);

                    BaseResult<string> br = requestViewBLL.GetWorkflowUnoperatorPersons(flow);
                    if (br.Code == Code.OK)
                    {
                        flow.Requestname = br.Object.Replace("\r\n", "");
                        gridControl1.DataSource = null;
                        gridControl1.DataSource = _list;
                    }
                    else
                    {
                        BoxHelper.Error(br.Message);
                    }
                }

            }
        }
        #endregion

        private List<Model.Workflow> _list;
        public List<Model.Workflow> List
        {
            set { gridControl1.DataSource = value; _list = value; }
            get { return _list; }
        }
    }
}